char*vBox =
    "mpfind (built: Oct 11 2015 20:12:53)\n"
    "Copyright (c) 2014-2015 kenvay\n";

int main (int argc, char **argv)
{
    //return main_t1(1,"test");
    if(argc!=2) 
    {
        printf("useage:%s filename\n",argv[0]);
        exit(0);
    }
    if(!strcmp(argv[1],"-v"))
    {
        printf(vBox);
        exit(0);
    }
    FILE * fd = fopen(argv[1],"rb");
    if(!fd)
    {
        printf("can not find %s\n",argv[1]);
        exit(-1);
    }
	int file_no = fileno(fd);
    struct stat logfilestat;
	fstat(file_no, &logfilestat);
    unsigned char*buf= (unsigned char*)malloc(logfilestat.st_size);
    if(!buf)
    {
        printf("alloc memery failed!\n");
        exit(1);
    }
    {
        fread ( buf, 1, logfilestat.st_size, fd);       
    }
    fclose(fd);
    MPattern*mp = MPatternInit("mpattern.txt",10, prePatternSearch,onPatternFind_1,(void*)1);
    ParamListType paramList = malloc(sizeof(char*)*RESULT_PARAM_CAPCITY);
    struct timespec start_time = {0, 0};  
    clock_gettime(CLOCK_REALTIME, &start_time);
    unsigned long start = start_time.tv_sec*1000000000UL+start_time.tv_nsec;
    MPatternSearch(mp,buf,logfilestat.st_size, paramList, NULL);
    clock_gettime(CLOCK_REALTIME, &start_time);
    unsigned long end = start_time.tv_sec*1000000000UL+start_time.tv_nsec;
    MpatternDisplay(mp,NULL);
    //printf(mstat);
    printf("elpase %lus,data %luB,speed %luns/B\n",(end-start)/1000000000,logfilestat.st_size,(end-start)/logfilestat.st_size);
    sleep(100);
    return 0;
}